In the so-called computer graphics (CG) technology field well known to the general public, a virtual three-dimensional space is established, objects are rendered and a virtual screen is provided in this space, and a rendered (displayed) image is projected and converted, and displayed on the screen. According to the CG technology, it is necessary to control a viewpoint in order to determine from what position an image seen in the virtual space should be displayed. The control of a viewpoint is important especially in such a game where a three-dimensional image is rendered in real time according to input from a controller. More specifically, an object to be noted may be hidden by another object depending on the setting of a viewpoint, which makes it impossible to obtain an intended image from that viewpoint. In such a case, it is a general practice to move the viewpoint to a position where the object to be noted is not hidden by another object.
For example, one example of such a conventional kind of three-dimensional image generating apparatus is disclosed in Japanese Patent Laying-open No. H9-167260 laid-open on Jun. 24, 1997 (document 1). According to document 1, if any hiding material such as another object comes in between an object to be operated and a camera in the game space, the camera is rotated and moved to a position where the hiding material does not hide the object to be operated. In this manner, the object to be operated is constantly displayed within the screen.
Also, another example of conventional three-dimensional image generating apparatus is disclosed in Japanese Patent Laying-open No. 2002-360920 laid-open on Dec. 17, 2002 (document 2). According to document 2, if any hiding material enters between a player character and a camera, the camera is brought closer to the player character until the hiding material no longer hides the player character.
Moreover, still another example of conventional three-dimensional image generating apparatus is disclosed in Japanese Patent Laying-open No. 2003-334380 laid-open on Nov. 25, 2003 (document 3). According to document 3, if any hiding material cuts in between a player character and a camera, the camera is moved inside the hiding material not so as to cause sudden changes in an image.
In any of the prior arts, however, the position of a camera is changed to move a viewpoint whenever a hiding material enters between an object to be operated (player character) and the camera. Thus, in case where a large number of objects are rendered in the virtual three-dimensional space, the viewpoint is moved at frequent intervals, which may cause an operator (player) discomfort. Also, the movement of the viewpoint takes place even in the case where only a portion of the object to be operated is hidden by the hiding material and in the case where it is permitted in terms of screen expressive technique that the object to be operated is hidden to some extent by the hiding material. To avoid this problem, it is conceivable to detect (calculate) a degree that the object to be operated is hidden (the degree of hiding) and control the movement of the viewpoint according to the degree of hiding. However, for detection of the degree of hiding, any of the prior arts requires increasing the number of gaze points and also such a process is to be performed in the three-dimensional space, which causes a problem of a growing load of operation.
The illustrative implementations provide a novel three-dimensional image generating apparatus, storage medium storing a three-dimensional image generating program, and three-dimensional image generating method.
One illustrative embodiment provides a three-dimensional image generating apparatus, storage medium storing a three-dimensional image generating program, and three-dimensional image generating method which make it easy to generate a display image where, with respect to a determination as to whether or not an object, to be considered out of objects followed by a camera, is hidden, a degree that the object is hidden is taken into consideration.
A further illustrative embodiment provides a three-dimensional image generating apparatus, storage medium storing a three-dimensional image generating program, and three-dimensional image generating method which make it possible to generate a display image that expresses a partially hidden object hidden.
A three-dimensional image generating apparatus according to an illustrative embodiment generates a three-dimensional image according to an operator's operation input. The three-dimensional image generating apparatus comprises an operation input detecting means, an object data storing means, a displaying means, a virtual three-dimensional space generating means, a viewpoint controlling means, a display image generating means, a depth value storing means, an object arrangement position storing means, a determination point setting means, a determining means, and a degree-of-hiding calculating means. The operation input detecting means detects the operator's operation input. The object data storing means stores object data for rendering objects forming a three-dimensional image. The displaying means displays an image projected onto a projection screen within a virtual three-dimensional space. The virtual three-dimensional space generating means generates the virtual three-dimensional space based on the operation input detected by the operation input detecting means and the object data stored in the object data storing means. The viewpoint controlling means controls a viewpoint within the virtual three-dimensional space generated by the virtual three-dimensional space generating means. The display image generating means generates the image of the virtual three-dimensional space seen from the viewpoint controlled by the viewpoint controlling means, which is projected onto the projection screen. The depth value storing means stores a depth value of each pixel of the image generated by the display image generating means. The object arrangement position storing means stores at least an arrangement position of a specific object in the virtual three-dimensional space. The determination point setting means sets a predetermined number of determination points in a predetermined area containing the arrangement position of the specific object in the image. The determining means determines whether or not a first depth value of the predetermined number of determination points set by the determination point setting means is smaller than a second depth value of the specific object. The degree-of-hiding calculating means calculates a degree of hiding of the specific object according to the number of the determination points where it is determined by the determining means that the first depth value is smaller than the second depth value.
More specifically, a three-dimensional image generating apparatus (12: reference numeral used for illustrative purposes) generates a three-dimensional image according to an operator's operation input. The operator's operation input is detected by an operation input detecting means (36, S1). An object data storing means (40) stores object data for rendering objects forming a three-dimensional image. A displaying means (34, 36, 38, 58) displays an image projected onto a projection screen within a virtual three-dimensional space. A virtual three-dimensional space generating means (36, 42, S3) generates the virtual three-dimensional space based on the operation input detected by the operation input detecting means (36, S1) and the object data stored in the object data storing means (40). A viewpoint controlling means (36, S5) controls a viewpoint (virtual camera) within the virtual three-dimensional space generated by the virtual three-dimensional space generating means (36, 42, S3). That is, it controls a position and orientation of the viewpoint. A display image generating means (36, 42, S7, S9, S11) generates the image of the virtual three-dimensional space seen from the viewpoint controlled by the viewpoint controlling means (36, S5), which is projected onto the projection screen. That is, a projection conversion process is carried out. A depth value storing means (50) stores a depth value (Z value) of each pixel of the image generated by the display image generating means (36, 42, S7, S9, S11). An object arrangement position storing means (36, 40) stores at least an arrangement position (current position) of a specific object in the virtual three-dimensional space. A determination point setting means (36, S15) sets a predetermined number of determination points in a predetermined area containing the arrangement position of the specific object of the projected and converted image. A determining means (36, S53 to S63) determines whether or not a first depth value of the predetermined number of determination points set by the determination point setting means (36, S65) is smaller than a second depth value of the specific object. That is, it determines whether or not there exists any hiding material between the viewpoint and the specific object. A degree-of-hiding calculating means (36, S65) calculates a degree of hiding of the specific object according to the number of the determination points where it is determined by the determining means that the first depth value is smaller than the second depth value.
According to the illustrative embodiments, the degree of hiding can be easily calculated because it is just determined whether or not the depth value of the determination points set for the specific projected and converted object is smaller than the depth value of the specific object.
In one illustrative embodiment, the determination point setting means sets the determination points in an area adjacent to and embracing the specific object projected onto the projection screen. More specifically, the determination point setting means (36, S15) sets determination points in an area adjacent to and embracing the specific object projected onto the projection screen. For example, determination points are set in proximity to the specific object. That is, the determination points are set in an area embracing the specific object, and thus it is possible to more accurately know the degree that the specific object is hidden by another object.
In another illustrative embodiment, in a case where the specific object in the virtual three-dimensional space is projected onto the projection screen, the determination point setting means sets the determination points on the circumference of a circle adjacent to and embracing the specific object projected onto the projection screen. More specifically, in a case where the specific object within the virtual three-dimensional space is projected onto the projection screen, the determination point setting means (36, S15) sets determination points on the circumference of a circle adjacent to and embracing the specific object projected onto the projection screen. As stated above, determination points are set on the circumference of a circle adjacent to and embracing the specific projected and converted object, and thus it is possible to set determination points more easily than set determination points on the circumference of a graphic form other than a circle.
In another illustrative embodiment, the degree-of-hiding calculating means calculates a proportion of the number of the determination points where it is determined by the determining means that the first depth value is smaller than the second depth value, with respect to the total number of the determination points. The viewpoint controlling means moves the viewpoint to another location according to the proportion calculated by the degree-of-hiding calculating means. More specifically, the degree-of-hiding calculating means (36, S65) calculates the proportion (degree of hiding) of the number of the determination points where it is determined by the determining means (36, S53 to S63) that the first depth value is smaller than the second depth value, with respect to the total number of determination points. The viewpoint controlling means (36, S25) moves the viewpoint to another location according to the degree of hiding (“YES” in a step S23) calculated by the degree-of-hiding calculating means. In this manner, the viewpoint is moved to another location according to the calculated degree of hiding, and thus, in case where the specific object is hard to see due to a high degree of hiding, for example, it is possible to move the viewpoint and generate an easy-to-see image of the specific object.
In a further illustrative embodiment, the viewpoint controlling means repeats the movement of the viewpoint until the proportion calculated by the degree-of-hiding calculating means becomes smaller than a predetermined value. More specifically, the viewpoint controlling means (36, S25) repeats the movement of the viewpoint until the proportion (degree of hiding) calculated by the degree-of-hiding calculating means (36, S65) becomes smaller than a predetermined value (“NO” in the step S23). As described above, the movement of the viewpoint is repeated until the degree of hiding becomes smaller than a predetermined value, and thus the viewpoint can be moved in such a manner that a hiding state is maintained to some extent, not in an abrupt manner. That is, it is possible to generate such an image where the specific object is hidden to some extent.
In still a further illustrative embodiment, the degree-of-hiding calculating means calculates a proportion of the number of the determination points where it is determined by the determining means that the first depth value is smaller than the second depth value, with respect to the total number of the determination points, and further comprises a parameter changing means for changing a parameter related to display of the specific object according to the proportion calculated by the degree-of-hiding calculating means. More specifically, the degree-of-hiding calculating means (36, S65) calculates a proportion (degree of hiding) of the number of the determination points where it is determined by the determining means (36, S53 to S63) that the first depth value is smaller than the second depth value. The parameter changing means (36, S21) changes a parameter related to display of the specific object according to the proportion calculated by the degree-of-hiding calculating means (36, S65). In this manner, it is also possible to generate an image according to the degree of hiding by changing a parameter related to display of the specific object according to the degree of hiding.
In yet a further embodiment, the specific object includes a light source and the parameter changing means changes at least the brightness of the light source. More specifically, the specific object includes a light source and the parameter changing means (36, S21) changes at least the brightness of the light source. Therefore, it is possible to generate such a screen where light from the light source shines from behind an object. This makes it possible to achieve a more real scenic effect.
A storage medium according to an illustrative embodiment stores a three-dimensional image generating program, and the three-dimensional image generating program is executed by a processor of a three-dimensional image generating apparatus. The three-dimensional image generating apparatus comprises an operation input detecting means, an object data storing means, a displaying means, and a depth value storing means. The operation input detecting means detects an operator's operation input. The object data storing means stores object data for rendering objects forming a three-dimensional image. The displaying means displays an image projected onto a projection screen within a virtual three-dimensional space. The depth value storing means stores a depth value of each pixel of the image.
The three-dimensional image generating program causes the processor of the three-dimensional image generating apparatus to execute a three-dimensional space generating step, a viewpoint controlling step, a display image generating step, an object arrangement position storing step, a determination point setting step, a determining step, and a degree-of-hiding calculating step. In the three-dimensional space generating step, a virtual three-dimensional space is generated on the basis of operation input detected by the operation input detecting means and object data stored in the object data storing means. In the viewpoint controlling step, a viewpoint is controlled within the virtual three-dimensional space generated in the virtual three-dimensional space generating step. In the display image generating step, an image of the virtual three-dimensional space seen from the viewpoint controlled by the viewpoint controlling step, which is projected onto a projection screen is generated. In the object arrangement position storing step, at least an arrangement position of a specific object in the virtual three-dimensional space is stored. In the determination point setting step, a predetermined number of determination points are set in a predetermined area embracing the arrangement position of the specific object in the image. In the determining step, it is determined whether or not a first depth value of the predetermined number of the determination points, set in the determination point setting step, is smaller than a second depth value of the specific object. In the degree-of-hiding calculating step, the degree of hiding of the specific object is calculated according to the number of the determination points where it is determined, in the determining step, that the first depth value is smaller than the second depth value.
In one exemplary storage medium storing a three-dimensional image generating program, it is possible to easily generate a display image with consideration given to the degree of hiding, as in the case with an exemplary three-dimensional image generating apparatus.
A three-dimensional image generating method according to an illustrative embodiment is a three-dimensional image generating method for a three-dimensional image generating apparatus comprising an operation input detecting means for detecting an operator's operation input, an object data storing means for storing object data for rendering objects forming a three-dimensional image, a displaying means for displaying an image projected onto a projection screen within a virtual three-dimensional space, and a depth value storing means for storing a depth value of each pixel of the image. The method includes the following steps of: (a) generating a virtual three-dimensional space based on the operation input detected by the operation input detecting means and the object data stored in the object data storing means; (b) controlling a viewpoint within the virtual three-dimensional space generated in step (a); (c) generating an image of the virtual three-dimensional space seen from the viewpoint controlled in step (b), which is projected onto the projection screen; (d) storing at least an arrangement position of a specific object in the virtual three-dimensional space; (e) setting a predetermined number of determination points in a predetermined area embracing the arrangement position of the specific object in the image; (f) determining whether or not a first depth value of the predetermined number of determination points set in step (e) is smaller than a second depth value of the specific object; and (g) calculating the degree of hiding of the specific object according to the number of the determination points where it is determined in step (f) that the first depth value is smaller than the second depth value.
In an exemplary three-dimensional image generating method, it is possible to easily generate a display image with consideration given to the degree of hiding, as in the case with an exemplary three-dimensional image generating apparatus.
The above described aspects of the illustrative embodiments will become more apparent from the following detailed description of the illustrative embodiments when taken in conjunction with the accompanying drawings.